package com.example.timeseletor

import TimePicker
import android.os.Bundle
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.bigkoo.pickerview.builder.TimePickerBuilder
import com.bigkoo.pickerview.listener.OnTimeSelectListener
import java.util.*

class TimeSelectorActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_time_selector)

        val selectedDate: Calendar = Calendar.getInstance()
        val startDate: Calendar = Calendar.getInstance()
        //startDate.set(2013,1,1);
        //startDate.set(2013,1,1);
        val endDate: Calendar = Calendar.getInstance()
        //endDate.set(2020,1,1);

        //正确设置方式 原因：注意事项有说明
        //endDate.set(2020,1,1);

        //正确设置方式 原因：注意事项有说明
        startDate.set(2013, 0, 1)
        endDate.set(2020, 11, 31)

        val pvTime=TimePickerBuilder(this,
            OnTimeSelectListener { date, v ->
Toast.makeText(this,date.toString(),Toast.LENGTH_LONG).show()
            }).build()
        pvTime.setOnDismissListener {
            Toast.makeText(this,"sss",Toast.LENGTH_LONG).show()
        }

        val timeSelector=TimePicker(this)
        timeSelector.setTitle("123")
        val textView=findViewById<TextView>(R.id.tvTest)
        textView.setText("455464651513232")
        textView.setOnClickListener {
            timeSelector.show()
        }
//        pvTime.returnData()
    }
}